package seismosurfer.data;

import java.io.Serializable;

/**
 * A Data Tranfer Object that corresponds to the <code>MAG_VIEW</code> view and
 * contains data from the <code>MAG</code> table.
 */
public class MagData implements Serializable {
    
    private static final long serialVersionUID = 1932524970344372682L;

    private long magnitudeID = 0;

    private double magnitude = 0;

    private String magnitudeType = "";

    private boolean calculated = false;

    private String magnitudeAgency = "";

    /**
     * Default constructor.
     */
    public MagData() {

    }

    /**
     * Gets magnitude ID.
     * 
     * @return the magnitude ID
     */
    public long getMagnitudeID() {
        return this.magnitudeID;
    }

    /**
     * Gets the agency that contributed this magnitude.
     * 
     * @return a string with the agency that contributed this magnitude
     */
    public String getMagnitudeAgency() {
        return this.magnitudeAgency;
    }

    /**
     * Gets the magnitude value.
     * 
     * @return a number with the magnitude value
     */
    public double getMagnitude() {
        return this.magnitude;
    }

    /**
     * Gets the magnitude type.
     * 
     * @return a string with the magnitude type
     */
    public String getMagnitudeType() {
        return this.magnitudeType;
    }

    /**
     * Specifies if this magnitude is calculated internally or is the original
     * taken from the data source.
     * 
     * @return true if it is calculated, false if it`s not
     */
    public boolean isCalculated() {
        return this.calculated;
    }

    // __________________________________________________________________________//

    /**
     * Sets magnitude ID.
     * 
     * @param magID
     *            the magnitude ID
     */
    public void setMagnitudeID(long magID) {
        this.magnitudeID = magID;
    }

    /**
     * Sets the agency that contributed this magnitude.
     * 
     * @param magAgency
     *            a string with the agency that contributed this magnitude
     */
    public void setMagnitudeAgency(String magAgency) {
        this.magnitudeAgency = magAgency;
    }

    /**
     * Sets the magnitude type.
     * 
     * @param magtype
     *            a string with the magnitude type
     */
    public void setMagnitudeType(String magtype) {
        if (magtype.equals("")) {
            magtype = "-";
        }
        this.magnitudeType = magtype;
    }

    /**
     * Specifies if this magnitude is calculated internally or is the original
     * taken from the data source.
     * 
     * @param calc
     *            true if it is calculated, false if it`s not
     */
    public void setCalculated(boolean calc) {
        this.calculated = calc;
    }

    /**
     * Sets the magnitude value.
     * 
     * @param mag
     *            number with the magnitude value
     */
    public void setMagnitude(double mag) {
        this.magnitude = mag;
    }

}
